package com.example.leetcode.linkedlist;

import com.example.leetcode.linkedlist.common.LinkedListUtils;
import com.example.leetcode.linkedlist.common.ListNode;

/**
 * Definition for singly-linked list.
 * public class ListNode {
 * int val;
 * ListNode next;
 * ListNode() {}
 * ListNode(int val) { this.val = val; }
 * ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution83 {
    public ListNode deleteDuplicates(ListNode head) {
        return LinkedListUtils.deleteDuplicates(head);
    }
}

public class leetcode83 {
    public static void main(String[] args) {
        Solution83 solution83 = new Solution83();
        int[] nums = {1, 1, 2};
        int[] nums1 = {1, 1, 2, 3, 3};
        int[] nums2 = {1, 1, 1};
        int[] nums3 = {};
        test83(solution83, nums);
        test83(solution83, nums1);
        test83(solution83, nums2);
        test83(solution83, nums3);
    }

    private static void test83(Solution83 solution83, int[] nums) {
        ListNode head = LinkedListUtils.generateLinkedListByArray(nums);
        solution83.deleteDuplicates(head);
        System.out.println(LinkedListUtils.getLinkedListVals(head));
    }
}
